#ifndef _WX_SSTREAM_H_
#define _WX_SSTREAM_H_

#include "wx/stream.h"

#if wxUSE_STREAMS





class wxStringInputStream : public wxInputStream {
  public:


    wxStringInputStream( const wxString& s );
    virtual ~wxStringInputStream();

    virtual wxFileOffset GetLength() const;

  protected:
    virtual wxFileOffset OnSysSeek( wxFileOffset ofs, wxSeekMode mode );
    virtual wxFileOffset OnSysTell() const;
    virtual size_t OnSysRead( void *buffer, size_t size );

  private:

    wxString m_str;


    char* m_buf;


    size_t m_len;


    size_t m_pos;

    DECLARE_NO_COPY_CLASS( wxStringInputStream )
};





class wxStringOutputStream : public wxOutputStream {
  public:


    wxStringOutputStream( wxString *pString = NULL ) {
      m_str = pString ? pString : &m_strInternal;
      m_pos = m_str->length() / sizeof( wxChar );
    }
    virtual ~wxStringOutputStream();
    const wxString& GetString() const { return *m_str; }

  protected:
    virtual wxFileOffset OnSysTell() const;
    virtual size_t OnSysWrite( const void *buffer, size_t size );

  private:

    wxString m_strInternal;


    wxString *m_str;


    size_t m_pos;

    #if wxUSE_WCHAR_T

    wxMBConvUTF8 m_conv;
    #else
    wxMBConv m_conv;
    #endif

    DECLARE_NO_COPY_CLASS( wxStringOutputStream )
};

#endif

#endif

